<template>
	<div class="TpRnaZ">
		<yd-cell-group>
			<yd-cell-item arrow>
				<span slot="left">房东身份</span>
				<span slot="right" @click="show1 = true">{{landtypename}}
                </span>
			</yd-cell-item>
		</yd-cell-group>
		
		<v-TpRna></v-TpRna>
		<yd-actionsheet :items="myItems1" v-model="show1" cancel="取消"></yd-actionsheet>
	</div>
</template>

<script>
	import { mapGetters, mapActions } from 'vuex'
	import api from '../fetch/api'
	import TpRna from "./TpRna";
	export default {
		name: "TpRnaZ",
		data() {
			return {
				isCertification: this.$route.query.isCertification,
				getHiss: JSON.parse(sessionStorage.getItem("userinfo")),
				show1: false,
				myItems1: [{
						label: '个人房东',
						callback: () => {
									this.setTpRnaType(1);
							this.setLandtypeName("个人房东");
							this.Getidentity();
							/* 注意： callback: function() {} 和 callback() {}  这样是无法正常使用当前this的 */
						}
					},
					{
						label: '企业房东',
						callback: () => {
									this.setTpRnaType(2);
							this.setLandtypeName("企业房东");
							this.Getidentity();
						}
					}
				]
			}
		},
		computed: {
			...mapGetters([
				'source',
				'landtypename',
			])
		},
		mounted(){
			this.Getidentity();
		},
		methods:{
			...mapActions({
				setTpRnaType:"setTpRnaType",
				setLandtypeName:'setLandtypeName',
				getGetidentitydata:'getGetidentitydata'
			}),
			
			Getidentity() {
				let ajaxSign = {
					source: this.source, // string 是
					userId: this.getHiss.id.toString(), // string 是
					token: this.getHiss.token // string 是
				}
				let ajaxData = api.getAES(ajaxSign);
				api.Getidentity(ajaxData)
					.then(res => {
						this.getGetidentitydata(res.result);
					})
			},
		},
		components: {
			"v-TpRna":TpRna
		}

	}
</script>

<style>

	.TpRnaZ .yd-cell-box{
		margin-bottom: 0 !important;
	}
</style>